﻿using Coldairarrow.Business.backstage.GrandTickets;
using Coldairarrow.Entity.backstage.GrandTickets;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coldairarrow.Api.Controllers.backstage.GrandTickets
{
    [Route("/backstage/GrandTickets/[controller]/[action]")]
    public class BS_GrantTicketController : BaseApiController
    {
        #region DI

        public BS_GrantTicketController(IBS_GrantTicketBusiness bS_GrantTicketBus)
        {
            _bS_GrantTicketBus = bS_GrantTicketBus;
        }

        IBS_GrantTicketBusiness _bS_GrantTicketBus { get; }

        #endregion

        #region 获取

        /// <summary>
        /// 后台——获取优惠券赠送历史列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageResult<GrantTicketDTO>> GetDataList(PageInput<ConditionDTO> input)
        {
            return await _bS_GrantTicketBus.GetDataListAsync(input);
        }

        /// <summary>
        /// 后台——获取优惠券赠送历史详情
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<GrantTicketDTO> GetTheData(IdInputDTO input)
        {
            return await _bS_GrantTicketBus.GetTheDataAsync(input.id);
        }


        [HttpPost]
        public async Task<List<SelectDTO>> GetTicketsList()
        {
            return await _bS_GrantTicketBus.GetTickesAsnyc();
        }

        [HttpPost]
        public async Task<List<SelectDTO>> GetUserList()
        {
            return await _bS_GrantTicketBus.GetUsersAsnyc();
        }


        #endregion

        #region 提交

        [HttpPost]
        public async Task SendUserTickets(GrantTicket input)
        {
            await _bS_GrantTicketBus.SendTicketAsnyc(input);
        }


        [HttpPost]
        public async Task DeleteData(List<string> ids)
        {
            await _bS_GrantTicketBus.DeleteDataAsync(ids);
        }

        #endregion
    }
}